package day05;
//方法参数的演示
public class MethodDemo_1 {
    public static void main(String[] args) {
        /*say(); //调用say方法
        System.out.println("over");   //--------实参
        sayHi("zhangsan"); //String name="zhangsan"
        sayHi("lisi"); //String name="lisi"
        sayHello("wangwu",30); //String name = "wangwu",int age=30
        sayHello("叫兽",59);   //--------实参
        sayHello("禽兽",66);   //--------实参
        sayHello("叫兽",59);   //--------实参
    */
        say(); //自动绑定无参say
        say("zhangsan"); //自动绑定String参的say
        say("lisi",30); //自动绑定String+int参的say
        //say(3.456); //编译错误，没有double参的say
    }

    //有参无返回值
    public static void say(String name,int age){ //-----形参
        if (age>=60){ //在某种特定条件下，提前结束方法
            return; //结束方法
        }
        System.out.println("大家好，我是"+name+",今年"+age+"岁了");
    }
    //有参无返回值
    public static void say(String name){  //-----形参
        System.out.println("大家好，我是"+name+",今年50岁了");
    }
    //无参无返回值
    public static void say(){  //-----形参
        System.out.println("大家好，我是张三，今年50岁了");
    }

    public static void say(int age){}  //正确的重载
    public static void say(int age,String name){}  //正确的重载
    //public static int say(){return 1}; //编译错误，重载与返回值类型无关
    //public static void say(String address){}  //编译错误，重载与参数名称无关
}
